// pages/mine/index.js
Page({
  data: {
    userinfo:{},
    flag:''
  },
  handleGetUserInfo(e){
    // console.log(e);
    const {userInfo}=e.detail;
    wx.setStorageSync("userinfo", userInfo);
    wx.reLaunch({
      url: '/pages/mine/mine',
    })
  },
  onShow(){
    const userinfo=wx.getStorageSync("userinfo");
    this.setData({userinfo})
  },
  logOut(){
    wx.showModal({
      title:'提示',
      content:'你确定要退出登陆吗',
      success:res => {
        if(res.confirm){
          console.log('用户已确认')
          wx.clearStorage({
            success: (res) => {
              wx.reLaunch({
                url: '/pages/mine/mine',
              })
            },
          })
          //刷新界面
          wx.reLaunch({
            url: '/pages/mine/mine'
          })
        }else{
          console.log('用户已取消')
        }
      }
    })
  }
})